<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <!--  keydown 键盘谈起   -->
        <!-- .enter 键盘修饰符  -->
        <input  @keydown.enter="downFn" v-model="task"  class="new-todo" placeholder="输入任务名称-回车确认" autofocus />
        <!-- @click 点击事件 -->
        <button  @click="btn">按钮</button>
   
    </div>

    <script>


       new Vue({
        el:"#app",
        data() {
            return {
                  // 定义模板中要使用的数据
                 task:""
            }
        },
        methods:{
            downFn() {
                console.log(this.task)
            },
            btn(){
                console.log(this.task)
            }

        }
       })

    </script>
</body>
</html>